package com.example.b_308.myapplication.model;

import com.example.b_308.myapplication.comment.OfficeContent;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by B-308 on 2017/11/27.
 */
public class OfficeResult {

    public int code;
    public String message;
    public String data;

    public OfficeResult(String json){
        if(null != json){
            try{
                JSONObject jsonObject = new JSONObject(json);
                this.code = jsonObject.getInt("code");
                this.message = jsonObject.getString("message");
                this.data = jsonObject.getString("data");
            }catch (JSONException e){
                this.code = OfficeContent.FAIL_BACK;
                this.message = OfficeContent.FAIL_BACK_MESSAGE;
            }
        }
    }

    public OfficeResult(int code, String message){
        this.code = code;
        this.message = message;
    }

    public int getCode(){
        return code;
    }

    public void setCode(int code){
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public void setData(String data) {
        this.data = data;
    }

}
